//
//  CZCommentTitleView.swift
//  GZWeibo666
//
//  Created by 123456 on 15/12/2.
//  Copyright © 2015年 itcast. All rights reserved.
//

import UIKit

class CZCommentTitleView: UIView {
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
        
    override init(frame: CGRect) {
        super.init(frame: frame)
        // 准备UI
        prepareUI()
    }

    /// 准备UI
    private func prepareUI() {
        // 添加子控件
        addSubview(userNameLabel)
        addSubview(titleLabel)
        
        // 布局子控件
        titleLabel.ff_AlignInner(type: ff_AlignType.TopCenter, referView: self, size: nil, offset: CGPointMake(0, 7))
//        titleLabel.ff_AlignInner(type: ff_AlignType.TopCenter, referView: self, size: nil , offset: )
        userNameLabel.ff_AlignVertical(type: ff_AlignType.BottomCenter, referView: titleLabel, size: nil)
        
    }
    
    // MARK: - 懒加载
    /// 用户名称
    private lazy var userNameLabel: UILabel  = {
        let label = UILabel(color: UIColor(white: 0.7, alpha: 1), fontSize: 12)
        label.text = CZUserAccount.loadUserAccount()?.screen_name
        
        
        label.sizeToFit()
        return label
    }()
    /// 标题
    lazy var titleLabel: UILabel = {
        let label = UILabel(color: UIColor(white: 0.3, alpha: 1), fontSize: 17)
        label.text = "发评论"
        
        label.sizeToFit()
        return label
    }()
    
}
